<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/js/axios.min.js"></script>
    <script src="/html/js/util.js"></script>

    <script>
        window.onload = function (){
            var info = getQuery("errorInfo");
            if(info == 'noland'){
                $("errorDiv").innerHTML = "对不起，请先登陆";
            }
            else if(info == "nograde"){
                $("errorDiv").innerHTML = "对不起，你没有权限";
            }
        }

        //登陆
        async function land(){
            var info = await ajaxGet("/user/login",{
                userName:$("userName").value,
                pwd:$("pwd").value
            });

            if(info == "no"){
               $("errorDiv").innerHTML = "登陆失败";
            }
            else if(info == "顾客"){
                location.href = "/html/index.html";
            }
            else if(info == "管理员"){
                location.href = "/html/manager/pressOrder.html";
            }
            else if(info == "送货员"){
                location.href = "/html/send/sendOrder.html";
            }
        }
    </script>
</head>
<body>
    <div style="color: red;font-size: 12px;" id="errorDiv"></div>
    用户名：<input type="text" id="userName"><br>
    密码：<input type="password" id="pwd" ><br>
    <input type="button" value="登陆" onclick="land()">
</body>
</html>